
#include "QuadEntity.h"

#include <SDL2/SDL_opengl.h>
#include <ALittleClient/LogSystem/LogSystem.h>

namespace ALittle
{

QuadEntity::QuadEntity()
: m_tex_top(0), m_tex_bottom(1), m_tex_left(0), m_tex_right(1)
, m_red(1), m_green(1), m_blue(1), m_alpha(1)
{ }

QuadEntity::~QuadEntity()
{
}

void QuadEntity::Draw()
{
	glBegin(GL_QUADS);
		glColor4f(m_red, m_green, m_blue, m_alpha);
		glTexCoord2f(m_tex_left,	m_tex_bottom);	glVertex3f(-0.5f, -0.5f, 0.0f);
		glTexCoord2f(m_tex_right,	m_tex_bottom);	glVertex3f(0.5f, -0.5f, 0.0f);
		glTexCoord2f(m_tex_right,	m_tex_top);		glVertex3f(0.5f, 0.5f, 0.0f);
		glTexCoord2f(m_tex_left,	m_tex_top);		glVertex3f(-0.5f, 0.5f, 0.0f);
	glEnd();
}

void QuadEntity::SetRed(float red)
{
	m_red = red;
}
void QuadEntity::SetGreen(float green)
{
	m_green = green;
}
void QuadEntity::SetBlue(float blue)
{
	m_blue = blue;
}

void QuadEntity::SetAlpha(float  alpha)
{
	m_alpha = alpha;
}

} // ALittle
